package com.bit.demo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-07-18
 * Time: 22:13
 */
public class GetBeanExample2 {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        //同时使用id和类名获取Bean
        UserService userService = context.getBean("user", UserService.class);
        userService.sayHi();
    }
}
